/*
*********************************************************************************************************
*                                             uC/GUI V3.98
*                        Universal graphic software for embedded applications
*
*                       (c) Copyright 2002, Micrium Inc., Weston, FL
*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
*              �C/GUI is protected by international copyright laws. Knowledge of the
*              source code may not be used to write a similar product. This file may
*              only be used in accordance with a license and should not be redistributed
*              in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File        : GUI.h
Purpose     : GUI API include file
---------------------------END-OF-HEADER------------------------------

Attention : Do not modify this file ! If you do, you will not
            be able do update to a later GUI version !

*/


#ifndef  GUI_H
#define  GUI_H
#define __EMWIN_GSC__   /* Allow "C" to find out that emWin GSC is used */


#include "GUI_ConfDefaults.h"
#include "GUIType.h"
#include "GUIVersion.h"
#include "GUI_ReDefine.h"
#include "GUI_Types.h"


#if defined(__cplusplus)
extern "C" {     /* Make sure we have C-declarations in C++ programs */
#endif

/*********************************************************************
*
*        Limitations for certain C51 Keil  (__C51__)
*
**********************************************************************
*/
#if defined (__C51__) && GUI_SUPPORT_MEMDEV
  //#error __C51__ (Keil) can not support function pointers sufficiently !  -> Disable memory devices  -> GUI_SUPPORT_MEMDEV 0
#endif

/*********************************************************************
*
*        macros, function replacement
*
**********************************************************************
*/
#define GUI_COUNTOF(a) (sizeof(a) / sizeof(a[0]))

/************************************************************
*
*                    GUI_KEY_...
*
*************************************************************
These ID values are basically meant to be used with widgets
Note that we have chosen the values to be close to existing
"standards", so do not change them unless forced to.

*/

#define GUI_KEY_BACKSPACE         8         /* ASCII: BACKSPACE Crtl-H */
#define GUI_KEY_TAB               9         /* ASCII: TAB       Crtl-I */
#define GUI_KEY_BACKTAB           10
#define GUI_KEY_ENTER             13        /* ASCII: ENTER     Crtl-M */
#define GUI_KEY_LEFT              16
#define GUI_KEY_UP                17
#define GUI_KEY_RIGHT             18
#define GUI_KEY_DOWN              19
#define GUI_KEY_HOME              23
#define GUI_KEY_END               24
#define GUI_KEY_SHIFT             25
#define GUI_KEY_CONTROL           26
#define GUI_KEY_ESCAPE            27        /* ASCII: ESCAPE    0x1b   */
#define GUI_KEY_INSERT            29
#define GUI_KEY_DELETE            30
#define GUI_KEY_SPACE             32
#define GUI_KEY_PGUP              33
#define GUI_KEY_PGDOWN            34

#define GUI_KEY_F1                40
#define GUI_KEY_F2                41


/*********************************************************************
*
*       Dialog item IDs
*
*  The IDs below are arbitrary values. They just have to be unique
*  within the dialog.
*
*  If you use your own Ids, we recommend to use values above GUI_ID_USER.
*/

#define GUI_ID_OK                1
#define GUI_ID_CANCEL            2
#define GUI_ID_YES               3
#define GUI_ID_NO                4
#define GUI_ID_CLOSE             5
#define GUI_ID_HELP              6
#define GUI_ID_MAXIMIZE          7
#define GUI_ID_MINIMIZE          8

#define GUI_ID_VSCROLL  0xFE
#define GUI_ID_HSCROLL  0xFF

#define GUI_ID_EDIT0    0x100
#define GUI_ID_EDIT1    0x101
#define GUI_ID_EDIT2    0x102
#define GUI_ID_EDIT3    0x103
#define GUI_ID_EDIT4    0x104
#define GUI_ID_EDIT5    0x105
#define GUI_ID_EDIT6    0x106
#define GUI_ID_EDIT7    0x107
#define GUI_ID_EDIT8    0x108
#define GUI_ID_EDIT9    0x109

#define GUI_ID_LISTBOX0 0x110
#define GUI_ID_LISTBOX1 0x111
#define GUI_ID_LISTBOX2 0x112
#define GUI_ID_LISTBOX3 0x113
#define GUI_ID_LISTBOX4 0x114
#define GUI_ID_LISTBOX5 0x115
#define GUI_ID_LISTBOX6 0x116
#define GUI_ID_LISTBOX7 0x117
#define GUI_ID_LISTBOX8 0x118
#define GUI_ID_LISTBOX9 0x119

#define GUI_ID_CHECK0   0x120
#define GUI_ID_CHECK1   0x121
#define GUI_ID_CHECK2   0x122
#define GUI_ID_CHECK3   0x123
#define GUI_ID_CHECK4   0x124
#define GUI_ID_CHECK5   0x125
#define GUI_ID_CHECK6   0x126
#define GUI_ID_CHECK7   0x127
#define GUI_ID_CHECK8   0x128
#define GUI_ID_CHECK9   0x129

#define GUI_ID_SLIDER0  0x130
#define GUI_ID_SLIDER1  0x131
#define GUI_ID_SLIDER2  0x132
#define GUI_ID_SLIDER3  0x133
#define GUI_ID_SLIDER4  0x134
#define GUI_ID_SLIDER5  0x135
#define GUI_ID_SLIDER6  0x136
#define GUI_ID_SLIDER7  0x137
#define GUI_ID_SLIDER8  0x138
#define GUI_ID_SLIDER9  0x139

#define GUI_ID_SCROLLBAR0 0x140
#define GUI_ID_SCROLLBAR1 0x141
#define GUI_ID_SCROLLBAR2 0x142
#define GUI_ID_SCROLLBAR3 0x142

#define GUI_ID_RADIO0 0x150
#define GUI_ID_RADIO1 0x151
#define GUI_ID_RADIO2 0x152
#define GUI_ID_RADIO3 0x153
#define GUI_ID_RADIO4 0x154
#define GUI_ID_RADIO5 0x155
#define GUI_ID_RADIO6 0x156
#define GUI_ID_RADIO7 0x157

#define GUI_ID_TEXT0  0x160
#define GUI_ID_TEXT1  0x161
#define GUI_ID_TEXT2  0x162
#define GUI_ID_TEXT3  0x163
#define GUI_ID_TEXT4  0x164
#define GUI_ID_TEXT5  0x165
#define GUI_ID_TEXT6  0x166
#define GUI_ID_TEXT7  0x167
#define GUI_ID_TEXT8  0x168
#define GUI_ID_TEXT9  0x169

#define GUI_ID_BUTTON0 0x170
#define GUI_ID_BUTTON1 0x171
#define GUI_ID_BUTTON2 0x172
#define GUI_ID_BUTTON3 0x173
#define GUI_ID_BUTTON4 0x174
#define GUI_ID_BUTTON5 0x175
#define GUI_ID_BUTTON6 0x176
#define GUI_ID_BUTTON7 0x177
#define GUI_ID_BUTTON8 0x178
#define GUI_ID_BUTTON9 0x179

#define GUI_ID_DROPDOWN0  0x180
#define GUI_ID_DROPDOWN1  0x181
#define GUI_ID_DROPDOWN2  0x182
#define GUI_ID_DROPDOWN3  0x183

#define GUI_ID_MULTIEDIT0 0x190
#define GUI_ID_MULTIEDIT1 0x191
#define GUI_ID_MULTIEDIT2 0x192
#define GUI_ID_MULTIEDIT3 0x193

#define GUI_ID_LISTVIEW0  0x200
#define GUI_ID_LISTVIEW1  0x201
#define GUI_ID_LISTVIEW2  0x202
#define GUI_ID_LISTVIEW3  0x203

#define GUI_ID_PROGBAR0   0x210
#define GUI_ID_PROGBAR1   0x211
#define GUI_ID_PROGBAR2   0x212
#define GUI_ID_PROGBAR3   0x213

#define GUI_ID_GRAPH0 0x220
#define GUI_ID_GRAPH1 0x221
#define GUI_ID_GRAPH2 0x222
#define GUI_ID_GRAPH3 0x223

#define GUI_ID_MULTIPAGE0 0x230
#define GUI_ID_MULTIPAGE1 0x231
#define GUI_ID_MULTIPAGE2 0x232
#define GUI_ID_MULTIPAGE3 0x233

#define GUI_ID_KEYBOARD     0x7FF
#define GUI_ID_USER     0x800

/*********************************************************************
*
*       Mouse buttons
*/
#define GUI_LBUTTON (1 << 0) /* Left button */
#define GUI_RBUTTON (1 << 1) /* Right button */
#define GUI_MBUTTON (1 << 2) /* Middle button */
#define GUI_DBUTTON (1 << 7) /* Double-click button */

/*********************************************************************
*
*       Wrap modes
*/
typedef enum { GUI_WRAPMODE_NONE, GUI_WRAPMODE_WORD, GUI_WRAPMODE_CHAR } GUI_WRAPMODE;

/*********************************************************************
*
*               Constants  needed for GL
*
**********************************************************************
*/

/**********************************
*
*      Text styles
*
***********************************
*/

#define GUI_TS_NORMAL           (0)
#define GUI_TS_UNDERLINE        (1 << 0)
#define GUI_TS_STRIKETHRU       (1 << 1)
#define GUI_TS_OVERLINE         (1 << 2)

/**********************************
*
*      Line styles
*
***********************************
*/

#define GUI_LS_SOLID        (0)
#define GUI_LS_DASH         (1)
#define GUI_LS_DOT          (2)
#define GUI_LS_DASHDOT      (3)
#define GUI_LS_DASHDOTDOT   (4)


/**********************************
*
*      Pen shapes
*
***********************************
*/

#define GUI_PS_ROUND        (0)
#define GUI_PS_FLAT         (1)
#define GUI_PS_SQUARE       (2)



/*      *********************************
        *
        *      Standard colors
        *
        *********************************
*/

#define GUI_BLUE          0xFFFF0000
#define GUI_GREEN         0xFF00FF00
#define GUI_RED           0xFF0000FF
#define GUI_CYAN          0xFFFFFF00
#define GUI_MAGENTA       0xFFFF00FF
#define GUI_YELLOW        0xFF00FFFF
#define GUI_LIGHTBLUE     0xFFFF8080
#define GUI_LIGHTGREEN    0xFF80FF80
#define GUI_LIGHTRED      0xFF8080FF
#define GUI_LIGHTCYAN     0xFFFFFF80
#define GUI_LIGHTMAGENTA  0xFFFF80FF
#define GUI_LIGHTYELLOW   0xFF80FFFF
#define GUI_DARKBLUE      0xFF800000
#define GUI_DARKGREEN     0xFF008000
#define GUI_DARKRED       0xFF000080
#define GUI_DARKCYAN      0xFF808000
#define GUI_DARKMAGENTA   0xFF800080
#define GUI_DARKYELLOW    0xFF008080
#define GUI_WHITE         0xFFFFFFFF
#define GUI_LIGHTGRAY     0xFFD3D3D3
#define GUI_GRAY          0xFF808080
#define GUI_DARKGRAY      0xFF404040
#define GUI_BLACK         0xFF000000

#define GUI_BROWN         0xFF2A2AA5

#define GUI_INVALID_COLOR 0xFFFFFF      /* Invalid color - more than 24 bits */

/*      *********************************
        *
        *      Coordinates
        *
        *********************************
*/
#define GUI_COORD_X 0
#define GUI_COORD_Y 1

/*********************************************************************
*
*            Standard Fonts
*
**********************************************************************

Note: The external declarations for the fonts are now also included in
      this file.
*/


/* Digits */
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD24x32;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD32;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD36x48;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD48;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD48x64;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD64;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD60x80;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontD80;

/* Comic fonts */
extern GUI_CONST_STORAGE GUI_FONT GUI_FontComic18B_ASCII, GUI_FontComic18B_1;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontComic24B_ASCII, GUI_FontComic24B_1;

/* AntiAlias Font */
extern GUI_CONST_STORAGE GUI_FONT GUI_FontNumberYH72;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontNumberYH48;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontASSIC_YH24;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontASSIC_YH32;
extern GUI_CONST_STORAGE GUI_FONT GUI_FontYH24;
/*
      *********************************
      *                               *
      * Text and drawing mode defines *
      *                               *
      *********************************

These defines come in two flavors: the long version (.._DRAWMODE_..)
and the short ones (.._DM_..). They are identical, feel free to use
which ever one you like best.

*/

#define GUI_DRAWMODE_NORMAL  LCD_DRAWMODE_NORMAL
#define GUI_DRAWMODE_XOR     LCD_DRAWMODE_XOR
#define GUI_DRAWMODE_TRANS   LCD_DRAWMODE_TRANS
#define GUI_DRAWMODE_REV     LCD_DRAWMODE_REV
#define GUI_DM_NORMAL        LCD_DRAWMODE_NORMAL
#define GUI_DM_XOR           LCD_DRAWMODE_XOR
#define GUI_DM_TRANS         LCD_DRAWMODE_TRANS
#define GUI_DM_REV           LCD_DRAWMODE_REV

#define GUI_TEXTMODE_NORMAL  LCD_DRAWMODE_NORMAL
#define GUI_TEXTMODE_XOR     LCD_DRAWMODE_XOR
#define GUI_TEXTMODE_TRANS   LCD_DRAWMODE_TRANS
#define GUI_TEXTMODE_REV     LCD_DRAWMODE_REV
#define GUI_TM_NORMAL        LCD_DRAWMODE_NORMAL
#define GUI_TM_XOR           LCD_DRAWMODE_XOR
#define GUI_TM_TRANS         LCD_DRAWMODE_TRANS
#define GUI_TM_REV           LCD_DRAWMODE_REV

/* Text alignment flags, horizontal */
#define GUI_TA_HORIZONTAL  (3<<0)
#define GUI_TA_LEFT        (0<<0)
#define GUI_TA_RIGHT	     (1<<0)
#define GUI_TA_CENTER	     (2<<0)
#define GUI_TA_HCENTER	   GUI_TA_CENTER  /* easier to remember :-)  */

/* Text alignment flags, vertical */
#define GUI_TA_VERTICAL   (3<<2)
#define GUI_TA_TOP	      (0<<2)
#define GUI_TA_BOTTOM	    (1<<2)
#define GUI_TA_BASELINE   (2<<2)
#define GUI_TA_VCENTER    (3<<2)

/*    *********************************
      *
      *     Min/Max coordinates
      *
      *********************************
*/
/* Define minimum and maximum coordinates in x and y */
#define GUI_XMIN -4095
#define GUI_XMAX  4095
#define GUI_YMIN -4095
#define GUI_YMAX  4095

#define GUI_FIX_DIV_BIT 	(12)
#define GUI_FIX_DIV			(1 << GUI_FIX_DIV_BIT)
#define GUI_FIX_DIV_1		(GUI_FIX_DIV - 1)

/*********************************************************************
*
*       Support for multitasking systems (locking)
*
**********************************************************************
*/

typedef struct GUI_CONTEXT GUI_CONTEXT;
extern U8 LOG_OPEN;
#define GUI_Debug(...)    		if(LOG_OPEN == 1)(GUI_LOG_OUT("MSG:%s->L%d(%s):", __FILE__, __LINE__, __func__),GUI_LOG_OUT(__VA_ARGS__))

/*********************************************************************
*
*             GUI_CONTEXT
*
**********************************************************************

  This structure is public for one reason only:
  To allow the application to save and restore the context.
*/

typedef union
{
	U8  aColorIndex8[2];
	U16 aColorIndex16[2];
	U32 aColorIndex32[2];
} LCD_COLORINDEX_UNION;

struct GUI_CONTEXT {
	/* Variables in LCD module */
	LCD_COLORINDEX_UNION 		LCD;
	LCD_RECT       				ClipRect;
	LCD_RECT					SaveCilpRect;
	U8             				DrawMode;
	U8            	 			SelLayer;
	U8             				TextStyle;
	/* Variables in GL module */
	/* High level clip rectangle ... Speed optimization so drawing routines can optimize */
	GUI_RECT* 					pClipRect_HL;
	U8        					PenSize;
	U8        					PenShape;
	U8        					LineStyle;
	U8        					FillStyle;
	/* Variables in GUICHAR module */
	const GUI_FONT           	GUI_UNI_PTR * pAFont;
	U32							FontScale;
#if GUI_SUPPORT_UNICODE
	/* Unicode encoding API */
	const GUI_UC_ENC_APILIST*	pUC_API;
#endif
	I16P 						LBorder;
	I16P 						DispPosX, DispPosY;
	I16P 						DrawPosX, DrawPosY;
	I16P 						TextMode, TextAlign;
	/* Required only when changing devices and for speed opt (caching) */
	GUI_COLOR 					Color, BkColor;
	U8							Alpha;
	U8							BitmapHasTrans;
	GUI_COLOR					BitmapTransColor;
	U8  						BitmapChangeAlpha;
	U8  						BitmapFlagChangeColor;
	GUI_COLOR 					BitmapChangeColor;
	/* Variables in WM module */
#if GUI_WINSUPPORT
	const GUI_RECT* 			WM__pUserClipRect;
	GUI_HWIN 					hAWin;
	I32 						xOff, yOff;
#endif

#if GUI_SUPPORT_DEVICES
	const tLCDDEV_APIList* 	pDeviceAPI;  /* function pointers only */
	GUI_RECT    ClipRectPrev;
#endif
	/* Variables in Anitaliasing module */
#if GUI_SUPPORT_AA
	/* Required to reroute drawing (HLine & Pixel) to the AA module */
	const tLCD_HL_APIList* 	pLCD_HL;
	U8 							AA_Factor;
	U8 							AA_HiResEnable;
#endif
};

/* Rename GUI_SaveContext in order to avoid crashes if wrong GUIConf is used */
#if   ( GUI_WINSUPPORT &&  GUI_SUPPORT_DEVICES)
  #define GUI_SaveContext GUI_SaveContext_W_M
#elif (!GUI_WINSUPPORT &&  GUI_SUPPORT_DEVICES)
  #define GUI_SaveContext GUI_SaveContext_M
#elif ( GUI_WINSUPPORT && !GUI_SUPPORT_DEVICES)
  #define GUI_SaveContext GUI_SaveContext_W
#else
  #define GUI_SaveContext GUI_SaveContext_
#endif

/*********************************************************************
*
*             General routines
*
**********************************************************************
*/
I32          GUI_Init             (void);
void 		 GUI_EnableLogOut		(void);
void 		 GUI_DisableLogOut		(void);
void         GUI_SetDefault       (void);
GUI_DRAWMODE GUI_SetDrawMode      (GUI_DRAWMODE dm);
const char * GUI_GetVersionString (void);
void         GUI_SaveContext      (      GUI_CONTEXT* pContext);
void         GUI_RestoreContext   (const GUI_CONTEXT* pContext);
void         GUI_SetScreenSizeX   (I32 xSize);
void         GUI_SetScreenSizeY   (I32 ySize);
I32          GUI_GetScreenSizeX   (void);
I32          GUI_GetScreenSizeY   (void);
const GUI_RECT * GUI_SetClipRect  (const GUI_RECT * pRect);

/*********************************************************************
*
*           Rectangle helper functions
*
**********************************************************************
*/

I32  GUI_RectsIntersect(const GUI_RECT* pr0, const GUI_RECT* pr1);
void GUI_MoveRect       (GUI_RECT *pRect, I32 x, I32 y);
void GUI_MergeRect      (GUI_RECT* pDest, const GUI_RECT* pr0, const GUI_RECT* pr1);
I32  GUI__IntersectRects(GUI_RECT* pDest, const GUI_RECT* pr0, const GUI_RECT* pr1);
void GUI__IntersectRect (GUI_RECT* pDest, const GUI_RECT* pr0);
void GUI__ReduceRect    (GUI_RECT* pDest, const GUI_RECT *pRect, I32 Dist);

/*********************************************************************
*
*       Misc helper functions
*
**********************************************************************
*/

I32  GUI__DivideRound     (I32 a, I32 b);
I32  GUI__DivideRound32   (I32 a, I32 b);
I32  GUI__SetText(GUI_HMEM* phText, const char* s);



/*********************************************************************
*
*      Get / Set Attributes
*
**********************************************************************
*/
 
GUI_COLOR GUI_GetBkColor     (void);
GUI_COLOR GUI_GetColor       (void);
I32       GUI_GetBkColorIndex(void);
I32       GUI_GetColorIndex  (void);
U8        GUI_GetPenSize     (void);
U8        GUI_GetPenShape    (void);
U8        GUI_GetLineStyle   (void);
U8        GUI_GetFillStyle   (void);

void      GUI_SetBkColor   (GUI_COLOR);
void      GUI_SetColor     (GUI_COLOR);
void      GUI_SetBkColorIndex(I32 Index);
void      GUI_SetColorIndex(I32 Index);

U8        GUI_SetPenSize   (U8 Size);
U8        GUI_SetPenShape  (U8 Shape);
U8        GUI_SetLineStyle (U8 Style);
U8        GUI_SetFillStyle (U8 Style);

/* Get/Set Character used as decimal point (usually '.' or ',') */
char      GUI_GetDecChar(void);
char      GUI_SetDecChar(char c);


/*********************************************************************
*
*       Color / Index related functions
*
**********************************************************************
*/

I32       GUI_Color2Index(GUI_COLOR color);
GUI_COLOR GUI_Color2VisColor(GUI_COLOR color);
char      GUI_ColorIsAvailable(GUI_COLOR color);
GUI_COLOR GUI_Index2Color(I32 Index);
void      GUI_InitLUT(void);
void      GUI_SetLUTEntry (U8 Pos, GUI_COLOR Color);
void      GUI_SetLUTColor (U8 Pos, GUI_COLOR Color);
void      GUI_SetLUTColorEx(U8 Pos, LCD_COLOR Color, U32 LayerIndex);
U32       GUI_CalcColorDist (GUI_COLOR Color0, GUI_COLOR  Color1);
U32       GUI_CalcVisColorError(GUI_COLOR color);

/*********************************************************************
*
*       Logging (for debugging primarily)
*
**********************************************************************
*/
void GUI_Log      (const char *s);
void GUI_Log1     (const char *s, I32 p0);
void GUI_Log2     (const char *s, I32 p0, I32 p1);
void GUI_Log3     (const char *s, I32 p0, I32 p1, I32 p2);
void GUI_Log4     (const char *s, I32 p0, I32 p1, I32 p2,I32 p3);
void GUI_Warn     (const char *s);
void GUI_Warn1    (const char *s, I32 p0);
void GUI_Warn2    (const char *s, I32 p0, I32 p1);
void GUI_Warn3    (const char *s, I32 p0, I32 p1, I32 p2);
void GUI_Warn4    (const char *s, I32 p0, I32 p1, I32 p2, I32 p3);
void GUI_ErrorOut (const char *s);
void GUI_ErrorOut1(const char *s, I32 p0);
void GUI_ErrorOut2(const char *s, I32 p0, I32 p1);
void GUI_ErrorOut3(const char *s, I32 p0, I32 p1, I32 p2);
void GUI_ErrorOut4(const char *s, I32 p0, I32 p1, I32 p2, I32 p3);

/*********************************************************************
*
*             2d - GL
*
**********************************************************************
*/

I32  GUI_BMP_Draw         (const void * pFileData, I32 x0, I32 y0);
I32  GUI_BMP_GetXSize     (const void * pFileData);
I32  GUI_BMP_GetYSize     (const void * pFileData);
void GUI_Clear            (void);
void GUI_ClearRect        (I32 x0, I32 y0, I32 x1, I32 y1);
void GUI_ClearRectEx      (const GUI_RECT* pRect);
void GUI_DrawArc          (I32 x0, I32 y0, I32 rx, I32 ry, I32 a0, I32 a1);
void GUI_DrawBitmap       (const GUI_BITMAP GUI_UNI_PTR * pBM, I32 x0, I32 y0);
void GUI_DrawBitmapMag    (const GUI_BITMAP GUI_UNI_PTR * pBM, I32 x0, I32 y0, I32 XMul, I32 YMul);
void GUI_DrawBitmapEx     (const GUI_BITMAP GUI_UNI_PTR * pBitmap, I32 x0, I32 y0, I32 xCenter, I32 yCenter, I32 xMag, I32 yMag);
void GUI_DrawBitmapExp    (I32 x0, I32 y0, I32 XSize, I32 YSize, I32 XMul,  I32 YMul, I32 BitsPerPixel, I32 BytesPerLine, const U8 GUI_UNI_PTR * pData, const GUI_LOGPALETTE GUI_UNI_PTR * pPal);
void GUI_DrawCircle       (I32 x0, I32 y0, I32 r);
void GUI_DrawEllipse      (I32 x0, I32 y0, I32 rx, I32 ry);
void GUI_DrawGraph        (I16 *pay, I32 NumPoints, I32 x0, I32 y0);
void GUI_DrawGraphEx      (I16 *pay, I32 NumPoints, I32 x0, I32 y0, I32 Numerator, I32 Denominator);
void GUI_DrawHLine        (I32 y0, I32 x0, I32 x1);
void GUI_DrawLine         (I32 x0, I32 y0, I32 x1, I32 y1);
void GUI_DrawLineRel      (I32 dx, I32 dy);
void GUI_DrawLineTo       (I32 x, I32 y);
void GUI_DrawPie          (I32 x0, I32 y0, I32 r, I32 a0, I32 a1, I32 Type);
void GUI_DrawPixel        (I32 x, I32 y);
void GUI_DrawPoint        (I32 x, I32 y);
void GUI_DrawPolygon      (const GUI_POINT* pPoints, I32 NumPoints, I32 x0, I32 y0);
void GUI_DrawPolyLine     (const GUI_POINT* pPoints, I32 NumPoints, I32 x0, I32 y0);
void GUI_DrawFocusRect    (const GUI_RECT *pRect, I32 Dist);
void GUI_DrawRect         (I32 x0, I32 y0, I32 x1, I32 y1);
void GUI_DrawRectEx       (const GUI_RECT *pRect);
void GUI_DrawVLine        (I32 x0, I32 y0, I32 y1);
void GUI_FillCircle       (I32 x0, I32 y0, I32 r);
void GUI_FillEllipse      (I32 x0, I32 y0, I32 rx, I32 ry);
void GUI_FillPolygon      (const GUI_POINT* pPoints, I32 NumPoints, I32 x0, I32 y0);
void GUI_FillRect         (I32 x0, I32 y0, I32 x1, I32 y1);
void GUI_FillRectEx       (const GUI_RECT* pRect);
void GUI_GetClientRect    (GUI_RECT* pRect);
I32  GUI_GIF_Draw         (const void * pGIF, U32 NumBytes, I32 x0, I32 y0);
I32  GUI_GIF_DrawEx       (const void * pGIF, U32 NumBytes, I32 x0, I32 y0, I32 Index);
I32  GUI_GIF_GetComment   (const void * pGIF, U32 NumBytes, U8 * pBuffer, I32 MaxSize, I32 Index);
I32  GUI_GIF_GetXSize     (const void * pGIF);
I32  GUI_GIF_GetYSize     (const void * pGIF);
I32  GUI_GIF_GetImageInfo (const void * pGIF, U32 NumBytes, GUI_GIF_IMAGE_INFO * pInfo, I32 Index);
I32  GUI_GIF_GetInfo      (const void * pGIF, U32 NumBytes, GUI_GIF_INFO * pInfo);
void GUI_InvertRect       (I32 x0, I32 y0, I32 x1, I32 y1);
void GUI_MoveRel          (I32 dx, I32 dy);
void GUI_MoveTo           (I32 x, I32 y);

/*set bitmap transplant function */
void GUI_SetDrawBitmapTransColor(GUI_COLOR TransColor);
void GUI_SetDrawBitmapHasTrans(U8 Status);
U8 GUI_GetDrawBitmapHasTrans(void);
/*********************************************************************
*
*       JPEG support
*
**********************************************************************
*/
typedef struct
{
	I32 XSize;
	I32 YSize;
} GUI_JPEG_INFO;

typedef I32 GUI_JPEG_GET_DATA_FUNC(void * p, I32 MaxNumBytes, const U8 ** ppData, unsigned StartOfFile);

I32  GUI_JPEG_Draw        (const void * pFileData, I32 DataSize, I32 x0, I32 y0);
I32  GUI_JPEG_DrawEx      (GUI_JPEG_GET_DATA_FUNC * fpGetData, void * p, I32 x0, I32 y0);
I32  GUI_JPEG_DrawScaled  (const void * pFileData, I32 DataSize, I32 x0, I32 y0, I32 Num, I32 Denom);
I32  GUI_JPEG_DrawScaledEx(GUI_JPEG_GET_DATA_FUNC * fpGetData, void * p, I32 x0, I32 y0, I32 Num, I32 Denom);
I32  GUI_JPEG_GetInfo     (const void * pFileData, I32 DataSize, GUI_JPEG_INFO* pInfo);
I32  GUI_JPEG_GetInfoEx   (GUI_JPEG_GET_DATA_FUNC * fpGetData, void * p, GUI_JPEG_INFO * pInfo);


/*********************************************************************
*
*              Text related routines
*
**********************************************************************
*/

void  GUI_DispCEOL (void);
void  GUI_DispChar  (U16 c);
void  GUI_DispChars (U16 c, I32 Cnt);
void  GUI_DispCharAt(U16 c, I16P x, I16P y);
void  GUI_DispString         (const char GUI_UNI_PTR *s);
void  GUI_DispStringAt       (const char GUI_UNI_PTR *s, I32 x, I32 y);
void  GUI_DispStringAtCEOL   (const char GUI_UNI_PTR *s, I32 x, I32 y);
void  GUI_DispStringHCenterAt(const char GUI_UNI_PTR *s, I32 x, I32 y);
void  GUI__DispStringInRect  (const char GUI_UNI_PTR *s, GUI_RECT* pRect, I32 TextAlign, I32 MaxNumChars);
void  GUI_DispStringInRect   (const char GUI_UNI_PTR *s, GUI_RECT* pRect, I32 Flags);
#if GUI_SUPPORT_ROTATION
  void  GUI_DispStringInRectEx (const char GUI_UNI_PTR *s, GUI_RECT* pRect, I32 TextAlign, I32 MaxLen, const GUI_ROTATION * pLCD_Api);
#endif
void  GUI_DispStringInRectMax(const char GUI_UNI_PTR *s, GUI_RECT* pRect, I32 TextAlign, I32 MaxLen); /* Not to be doc. */
void  GUI_DispStringInRectWrap(const char GUI_UNI_PTR *s, GUI_RECT* pRect, I32 TextAlign, GUI_WRAPMODE WrapMode); /* Not to be doc. */
void  GUI_DispStringLen      (const char GUI_UNI_PTR *s, I32 Len);
void  GUI_GetTextExtend(GUI_RECT* pRect, const char GUI_UNI_PTR * s, I32 Len);
I32   GUI_GetYAdjust(void);
I32   GUI_GetDispPosX(void);
I32   GUI_GetDispPosY(void);
const GUI_FONT GUI_UNI_PTR * GUI_GetFont(void);
I32   GUI_GetCharDistX(U16 c);
I32   GUI_GetStringDistX(const char GUI_UNI_PTR *s);
GUI_DRAWMODE GUI_GetDrawMode(void);
I32   GUI_GetFontDistY(void);
I32   GUI_GetFontSizeY(void);
void  GUI_GetFontInfo   (const GUI_FONT GUI_UNI_PTR * pFont, GUI_FONTINFO* pfi);
void  GUI_GetOrg(I32 * px, I32 * py);
I32   GUI_GetYSizeOfFont(const GUI_FONT GUI_UNI_PTR * pFont);
I32   GUI_GetYDistOfFont(const GUI_FONT GUI_UNI_PTR * pFont);
I32   GUI_GetTextAlign(void);
I32   GUI_GetTextMode(void);
char  GUI_IsInFont(const GUI_FONT GUI_UNI_PTR * pFont, U16 c);
I32   GUI_SetTextAlign(I32 Align);
I32   GUI_SetTextMode(I32 Mode);
char  GUI_SetTextStyle(char Style);
I32   GUI_SetLBorder(I32 x);
void  GUI_SetOrg(I32 x, I32 y);
const GUI_FONT GUI_UNI_PTR * GUI_SetFont(const GUI_FONT GUI_UNI_PTR * pNewFont);
float GUI_SetFontScale(float Scale);
float GUI_GetFontScale(void);
char  GUI_GotoXY(I32 x, I32 y);
char  GUI_GotoX(I32 x);
char  GUI_GotoY(I32 y);
void  GUI_DispNextLine(void);



//add some function for bitmap
U8 			GUI_GetDrawBitmapHasTrans		(void);
void 		GUI_SetDrawBitmapHasTrans		(U8 Status);
void 		GUI_SetDrawBitmapTransColor		(GUI_COLOR TransColor);

/*********************************************************************
*
*       Position independent fonts
*
**********************************************************************
*/
void GUI_SIF_CreateFont(void * pFontData, GUI_FONT * pFont, const GUI_SIF_TYPE * pFontType);
void GUI_SIF_DeleteFont(GUI_FONT * pFont);

/*********************************************************************
*
*         Unicode support
*
**********************************************************************
*/

I32   GUI_UC_ConvertUC2UTF8   (const U16 GUI_UNI_PTR * s, I32 Len, char * pBuffer, I32 BufferSize);
I32   GUI_UC_ConvertUTF82UC   (const char GUI_UNI_PTR * s, I32 Len, U16 * pBuffer, I32 BufferSize);
I32   GUI_UC_Encode           (char* s, U16 Char);
I32   GUI_UC_GetCharSize      (const char GUI_UNI_PTR * s);
U16   GUI_UC_GetCharCode      (const char GUI_UNI_PTR * s);
void  GUI_UC_SetEncodeNone    (void);
void  GUI_UC_SetEncodeUTF8    (void);

void GUI_UC_DispString(const U16 GUI_UNI_PTR *s);
void GUI_UC2DB (U16 Code, U8* pOut);
U16  GUI_DB2UC (U8 Byte0, U8 Byte1);

/*    *********************************
      *                               *
      *         GUIVAL.C              *
      *                               *
      *********************************
*/

void GUI_DispBin  (U32  v, U8 Len);
void GUI_DispBinAt(U32  v, I16P x, I16P y, U8 Len);
void GUI_DispDec  (I32 v, U8 Len);
void GUI_DispDecAt (I32 v, I16P x, I16P y, U8 Len);
void GUI_DispDecMin(I32 v);
void GUI_DispDecShift(I32 v, U8 Len, U8 Shift);
void GUI_DispDecSpace(I32 v, U8 MaxDigits);
void GUI_DispHex  (U32 v, U8 Len);
void GUI_DispHexAt(U32 v, I16P x, I16P y, U8 Len);
void GUI_DispSDec(I32 v, U8 Len);
void GUI_DispSDecShift(I32 v, U8 Len, U8 Shift);

/*    *********************************
      *                               *
      *         GUIVALF.C             *
      *                               *
      *********************************

Routines to display floating point values. These routines use the routines
defined in the module GUIVAL.C as base routines.

*/

void GUI_DispFloat    (float v, char Len);
void GUI_DispFloatFix (float v, char Len, char Fract);
void GUI_DispFloatMin (float v, char Fract);
void GUI_DispSFloatFix(float v, char Len, char Fract);
void GUI_DispSFloatMin(float v, char Fract);


/*********************************************************************
*
*         Dynamic memory management
*
**********************************************************************
*/

#if !defined(GUI_ALLOC_ALLOC)
  /* diagnostics */
  GUI_ALLOC_DATATYPE GUI_ALLOC_GetNumFreeBytes (void);
  GUI_ALLOC_DATATYPE GUI_ALLOC_GetNumFreeBlocks(void);
  GUI_ALLOC_DATATYPE GUI_ALLOC_GetNumUsedBytes (void);
  GUI_ALLOC_DATATYPE GUI_ALLOC_GetNumUsedBlocks(void);
#else
  #define GUI_ALLOC_GetNumFreeBytes()  0
  #define GUI_ALLOC_GetNumFreeBlocks() 0
  #define GUI_ALLOC_GetNumUsedBytes()  0
  #define GUI_ALLOC_GetNumUsedBlocks() 0
#endif

GUI_HMEM           GUI_ALLOC_AllocInit  (const void *pInitData, GUI_ALLOC_DATATYPE Size);
GUI_HMEM           GUI_ALLOC_AllocNoInit(GUI_ALLOC_DATATYPE size);
GUI_HMEM           GUI_ALLOC_AllocZero  (GUI_ALLOC_DATATYPE size);
void               GUI_ALLOC_Free       (GUI_HMEM  hMem);
void               GUI_ALLOC_FreePtrArray(GUI_HMEM * pArray, I32 NumElems);
void               GUI_ALLOC_FreePtr    (GUI_HMEM *phMem);
GUI_ALLOC_DATATYPE GUI_ALLOC_GetSize    (GUI_HMEM  hMem);
GUI_ALLOC_DATATYPE GUI_ALLOC_GetMaxSize (void);
void*              GUI_ALLOC_h2p        (GUI_HMEM  hMem);
void               GUI_ALLOC_Init       (void);
GUI_HMEM           GUI_ALLOC_Realloc    (GUI_HMEM hOld, I32 NewSize);
void               GUI_ALLOC_Lock       (void);
void               GUI_ALLOC_Unlock     (void);



void GUI_SelectLCD(void);
U32 GUI_SelectLayer(U32 Index);

/**************************************************************
*
*      Measure device: GUI_MEASDEV
*
***************************************************************
*/

typedef GUI_HMEM GUI_MEASDEV_Handle;

GUI_MEASDEV_Handle GUI_MEASDEV_Create (void);
void               GUI_MEASDEV_Delete (GUI_MEASDEV_Handle hMemDev);
void               GUI_MEASDEV_Select (GUI_MEASDEV_Handle hMem);
void               GUI_MEASDEV_GetRect(GUI_MEASDEV_Handle hMem, GUI_RECT *pRect);
void               GUI_MEASDEV_ClearRect(GUI_MEASDEV_Handle hMem);

/************************************************************
*
*                 Polygon helpers
*
*************************************************************
*/
void GUI_RotatePolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, I32 NumPoints, float Angle);
void GUI_MagnifyPolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, I32 NumPoints, I32 Mag);
void GUI_EnlargePolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, I32 NumPoints, I32 Len);

/************************************************************
*
*                 Streamed bitmap
*
*************************************************************
*/
void GUI_DrawStreamedBitmap(const GUI_BITMAP_STREAM *pBitmapStream, I32 x, I32 y);

/************************************************************
*
*                 BMP-export
*
*************************************************************
*/
typedef void GUI_CALLBACK_VOID_U8_P(U8 Data, void * p);

void GUI_BMP_SerializeEx(GUI_CALLBACK_VOID_U8_P * pfSerialize, I32 x0, I32 y0, I32 xSize, I32 ySize, void * p);
void GUI_BMP_Serialize  (GUI_CALLBACK_VOID_U8_P * pfSerialize, void * p);

/*********************************************************************
*
*      Time / execution related routines
*
**********************************************************************
*/
U32  GUI_GetTime(void);
void GUI_TimeIncrease(U32 TickPeriod);
U32 GUI_GetTimeElapsed(U32 PrevTime);
I32  GUI_Exec(void);         /* Execute all jobs ... Return 0 if nothing was done. */
I32  GUI_Exec1(void);        /* Execute one job  ... Return 0 if nothing was done. */

/*********************************************************************
*
*                 MessageBox
*
**********************************************************************

  Note: These should be moved into a separate file.
*/
I32     GUI_MessageBox   (const char * sMessage, const char * sCaption, I32 Flags);
#define GUI_MESSAGEBOX_CF_MOVEABLE (1 << 0)
#define GUI_MESSAGEBOX_CF_MODAL    (1 << 1)

#define GUI_MB_OK                20
#define GUI_MB_WARNING           21

/*********************************************************************
*
*                 GUI_TIMER module
*
**********************************************************************
*/

typedef struct {
  GUI_TIMER_TIME Time;
  U32            Context;
} GUI_TIMER_MESSAGE;

typedef GUI_HMEM GUI_TIMER_HANDLE;
typedef void GUI_TIMER_CALLBACK(/*const*/ GUI_TIMER_MESSAGE* pTM);

GUI_TIMER_HANDLE GUI_TIMER_Create   (GUI_TIMER_CALLBACK* cb, I32 Time,  U32 Context, I32 Flags);
void             GUI_TIMER_Delete  	(GUI_TIMER_HANDLE hObj);
void GUI_TIMER_DeleteByContext		(U32 Context);

/* Methods changing properties */
void GUI_TIMER_SetPeriod (GUI_TIMER_HANDLE hObj, GUI_TIMER_TIME Period);
void GUI_TIMER_SetTime   (GUI_TIMER_HANDLE hObj, GUI_TIMER_TIME Period);
void GUI_TIMER_SetDelay  (GUI_TIMER_HANDLE hObj, GUI_TIMER_TIME Delay);
void GUI_TIMER_Restart   (GUI_TIMER_HANDLE hObj);
I32  GUI_TIMER_Exec(void);


/******************************************************************
*
*                 Anti Aliasing
*
*******************************************************************
*/

void GUI_AA_DisableHiRes     (void);
void GUI_AA_EnableHiRes      (void);
I32  GUI_AA_GetFactor        (void);
void GUI_AA_SetFactor        (I32 Factor);
void GUI_AA_DrawArc          (I32 x0, I32 y0, I32 rx, I32 ry, I32 a0, I32 a1);
void GUI_AA_DrawLine         (I32 x0, I32 y0, I32 x1, I32 y1);
void GUI_AA_DrawPolyOutline  (const GUI_POINT * pSrc, I32 NumPoints, I32 Thickness, I32 x, I32 y);
void GUI_AA_DrawPolyOutlineEx(const GUI_POINT * pSrc, I32 NumPoints, I32 Thickness, I32 x, I32 y, GUI_POINT * pBuffer);
void GUI_AA_FillCircle       (I32 x0, I32 y0, I32 r);
void GUI_AA_FillPolygon      (GUI_POINT* pPoints, I32 NumPoints, I32 x0, I32 y0);

/**************************************************************************
 * RECT Process
 ************************************************************************
 * */
#define GUI_RectIntersect		WM_RectIntersect
#define GUI_RectIntersectLCD	WM_RectIntersectLCD
#define GUI_RectIsIn			WM_RectIsIn
#define GUI_RectSet			WM_RectSet
#define GUI_RectToMax			WM_RectToMax
#define GUI_RectGetWidth		WM_RectGetWidth
#define GUI_RectGetHeight		WM_RectGetHeight
#define GUI_RectReduceX			WM_RectReduceX
#define GUI_RectReduceY			WM_RectReduceY
#define GUI_RectReduce			WM_RectReduce
/******************************************************************
*
*                 Keyboard
*
*******************************************************************
*/

/* Message layer */
void GUI_StoreKeyMsg(I32 Key, I32 Pressed);
void GUI_SendKeyMsg (I32 Key, I32 Pressed);
I32  GUI_PollKeyMsg(void);

/* Message hook */
typedef I32 GUI_KEY_MSG_HOOK(I32 Key, I32 Pressed);
extern  GUI_KEY_MSG_HOOK* GUI_pfKeyMsgHook;
GUI_KEY_MSG_HOOK* GUI_SetKeyMsgHook(GUI_KEY_MSG_HOOK* pHook);

/* Application layer */
I32  GUI_GetKey(void);
I32  GUI_WaitKey(void);
void GUI_StoreKey(I32 c);
void GUI_ClearKeyBuffer(void);

/*********************************************************************
*
*       Task syncronisation (depends on configuration)
*/
void GUI_WaitEvent(void);

/*********************************************************************
*
*          PID  (Pointer input device ... mouse/touch) 
*/

void GUI_PID_StoreState(const GUI_PID_STATE *pState);
I32  GUI_PID_GetState  (      GUI_PID_STATE *pState);

/*********************************************************************
*
*        Mouse, generic
*/
I32  GUI_MOUSE_GetState  (      GUI_PID_STATE *pState);
void GUI_MOUSE_StoreState(const GUI_PID_STATE *pState);

/*********************************************************************
*
*          TOUCH screen, generic
*/

I32  GUI_TOUCH_GetState     (GUI_PID_STATE *pState);
void GUI_TOUCH_GetUnstable  (I32* px, I32* py);  /* for diagnostics only */
void GUI_TOUCH_StoreState   (I32 x, I32 y);
void GUI_TOUCH_StoreStateEx (const GUI_PID_STATE *pState);
void GUI_TOUCH_StoreUnstable(I32 x, I32 y);


/*********************************************************************
*
*        Mouse, PS2 driver
*/
void GUI_MOUSE_DRIVER_PS2_Init(void);               /* optional */
void GUI_MOUSE_DRIVER_PS2_OnRx(unsigned char Data);


/*********************************************************************
*
*          TOUCH screen, analog driver
*/
void GUI_TOUCH_Exec(void);
void GUI_TouchDriverRegister(GUI_GetTouchData *pDriver);

/*********************************************************************
*
*          TOUCH
*
*          imports
*
**********************************************************************

Please note: The following functions are required by the module.
They need to be part of your application software (or rather, part
of the hardware-layer of your software).
*/

void GUI_TOUCH_X_ActivateX(void);
void GUI_TOUCH_X_ActivateY(void);
void GUI_TOUCH_X_Disable(void);
I32  GUI_TOUCH_X_MeasureX(void);
I32  GUI_TOUCH_X_MeasureY(void);

/**************************************************************
*
*   Constants for fonts and bitmaps
*
***************************************************************
*/

extern const GUI_BITMAP_METHODS GUI_BitmapMethodsRLE4;
extern const GUI_BITMAP_METHODS GUI_BitmapMethodsRLE8;
extern const GUI_BITMAP_METHODS GUI_BitmapMethodsRLE16;
extern const GUI_BITMAP_METHODS GUI_BitmapMethodsRLEM16;
//pixel format is compress REL RGB565
extern const GUI_BITMAP_METHODS GUI_BitmapMethodsRLEM16M;
//pixel format is compress REL ARGB8565
extern const GUI_BITMAP_METHODS GUI_BitmapMethodAlphaRLEM16M;
//pixel format is compress REL BGR565
extern const GUI_BITMAP_METHODS GUI_BitmapMethodsRLE16M;
//pixel format is compress REL BGR8565
extern const GUI_BITMAP_METHODS GUI_BitmapMethodAlphaRLE16M;
//pixel format is BMP ARGB8565
extern const GUI_BITMAP_METHODS GUI_BMPAlphaM16M;
//pixel format is BMP ABGR8565
extern const GUI_BITMAP_METHODS GUI_BMPAlpha16M;

extern const GUI_BITMAP_METHODS GUI_BitmapMethods555;
extern const GUI_BITMAP_METHODS GUI_BitmapMethodsM555;
extern const GUI_BITMAP_METHODS GUI_BitmapMethods565;
extern const GUI_BITMAP_METHODS GUI_BitmapMethodsM565;
extern const GUI_BITMAP_METHODS GUI_BitmapMethods888;
extern const GUI_BITMAP_METHODS GUI_BitmapMethodsM888;

#define GUI_COMPRESS_RLE4 0
#define GUI_COMPRESS_RLE8 0

#define GUI_DRAW_RLE4    			&GUI_BitmapMethodsRLE4   		/* Method table ! */
#define GUI_DRAW_RLE8    			&GUI_BitmapMethodsRLE8   		/* Method table ! */
#define GUI_DRAW_RLE16   			&GUI_BitmapMethodsRLE16  		/* Method table ! */
#define GUI_DRAW_RLEM16  			&GUI_BitmapMethodsRLEM16 		/* Method table ! */
#define GUI_DRAW_RLEM16M   			&GUI_BitmapMethodsRLEM16M  		/* Method table ! */
#define GUI_DRAW_AlphaRLEM16M  		&GUI_BitmapMethodAlphaRLEM16M 	/* Method table ! */
#define GUI_DRAW_RLE16M   			&GUI_BitmapMethodsRLE16M  		/* Method table ! */
#define GUI_DRAW_AlphaRLE16M  		&GUI_BitmapMethodAlphaRLE16M 	/* Method table ! */
#define GUI_DRAW_BMP555  			&GUI_BitmapMethods555    		/* Method table ! */
#define GUI_DRAW_BMPM555 			&GUI_BitmapMethodsM555   		/* Method table ! */
#define GUI_DRAW_BMP565  			&GUI_BitmapMethods565    		/* Method table ! */
#define GUI_DRAW_BMPM565 			&GUI_BitmapMethodsM565   		/* Method table ! */
#define GUI_DRAW_BMP888  			&GUI_BitmapMethods888    		/* Method table ! */
#define GUI_DRAW_BMPM888 			&GUI_BitmapMethodsM888   		/* Method table ! */

#define GUI_DRAW_BMPAM16M 			&GUI_BMPAlphaM16M   			/* Method table ! */
#define GUI_DRAW_BMPA16M 			&GUI_BMPAlpha16M   				/* Method table ! */

void GUI_SetBitmapAlpha				(U8 Alpha);
void GUI_SetBitmapChangeColor		(GUI_COLOR Color);

extern const uctGUI_SIF_APIList GUI_SIF_APIList_Prop;
extern const uctGUI_SIF_APIList GUI_SIF_APIList_Prop_AA2;
extern const uctGUI_SIF_APIList GUI_SIF_APIList_Prop_AA4;

/*
 * Register GUI Driver
 *
 * */
void GUI_DriverInit(GUI_Driver_t *pDriver);
void GUI_DriverRegister(GUI_Driver_t *pDriver);
/**************************************************************
*
*      Defines for constants
*
***************************************************************
*/

#define	________	0x0
#define	_______X	0x1
#define	______X_	0x2
#define	______XX	0x3
#define	_____X__	0x4
#define	_____X_X	0x5
#define	_____XX_	0x6
#define	_____XXX	0x7
#define	____X___	0x8
#define	____X__X	0x9
#define	____X_X_	0xa
#define	____X_XX	0xb
#define	____XX__	0xc
#define	____XX_X	0xd
#define	____XXX_	0xe
#define	____XXXX	0xf
#define	___X____	0x10
#define	___X___X	0x11
#define	___X__X_	0x12
#define	___X__XX	0x13
#define	___X_X__	0x14
#define	___X_X_X	0x15
#define	___X_XX_	0x16
#define	___X_XXX	0x17
#define	___XX___	0x18
#define	___XX__X	0x19
#define	___XX_X_	0x1a
#define	___XX_XX	0x1b
#define	___XXX__	0x1c
#define	___XXX_X	0x1d
#define	___XXXX_	0x1e
#define	___XXXXX	0x1f
#define	__X_____	0x20
#define	__X____X	0x21
#define	__X___X_	0x22
#define	__X___XX	0x23
#define	__X__X__	0x24
#define	__X__X_X	0x25
#define	__X__XX_	0x26
#define	__X__XXX	0x27
#define	__X_X___	0x28
#define	__X_X__X	0x29
#define	__X_X_X_	0x2a
#define	__X_X_XX	0x2b
#define	__X_XX__	0x2c
#define	__X_XX_X	0x2d
#define	__X_XXX_	0x2e
#define	__X_XXXX	0x2f
#define	__XX____	0x30
#define	__XX___X	0x31
#define	__XX__X_	0x32
#define	__XX__XX	0x33
#define	__XX_X__	0x34
#define	__XX_X_X	0x35
#define	__XX_XX_	0x36
#define	__XX_XXX	0x37
#define	__XXX___	0x38
#define	__XXX__X	0x39
#define	__XXX_X_	0x3a
#define	__XXX_XX	0x3b
#define	__XXXX__	0x3c
#define	__XXXX_X	0x3d
#define	__XXXXX_	0x3e
#define	__XXXXXX	0x3f
#define	_X______	0x40
#define	_X_____X	0x41
#define	_X____X_	0x42
#define	_X____XX	0x43
#define	_X___X__	0x44
#define	_X___X_X	0x45
#define	_X___XX_	0x46
#define	_X___XXX	0x47
#define	_X__X___	0x48
#define	_X__X__X	0x49
#define	_X__X_X_	0x4a
#define	_X__X_XX	0x4b
#define	_X__XX__	0x4c
#define	_X__XX_X	0x4d
#define	_X__XXX_	0x4e
#define	_X__XXXX	0x4f
#define	_X_X____	0x50
#define	_X_X___X	0x51
#define	_X_X__X_	0x52
#define	_X_X__XX	0x53
#define	_X_X_X__	0x54
#define	_X_X_X_X	0x55
#define	_X_X_XX_	0x56
#define	_X_X_XXX	0x57
#define	_X_XX___	0x58
#define	_X_XX__X	0x59
#define	_X_XX_X_	0x5a
#define	_X_XX_XX	0x5b
#define	_X_XXX__	0x5c
#define	_X_XXX_X	0x5d
#define	_X_XXXX_	0x5e
#define	_X_XXXXX	0x5f
#define	_XX_____	0x60
#define	_XX____X	0x61
#define	_XX___X_	0x62
#define	_XX___XX	0x63
#define	_XX__X__	0x64
#define	_XX__X_X	0x65
#define	_XX__XX_	0x66
#define	_XX__XXX	0x67
#define	_XX_X___	0x68
#define	_XX_X__X	0x69
#define	_XX_X_X_	0x6a
#define	_XX_X_XX	0x6b
#define	_XX_XX__	0x6c
#define	_XX_XX_X	0x6d
#define	_XX_XXX_	0x6e
#define	_XX_XXXX	0x6f
#define	_XXX____	0x70
#define	_XXX___X	0x71
#define	_XXX__X_	0x72
#define	_XXX__XX	0x73
#define	_XXX_X__	0x74
#define	_XXX_X_X	0x75
#define	_XXX_XX_	0x76
#define	_XXX_XXX	0x77
#define	_XXXX___	0x78
#define	_XXXX__X	0x79
#define	_XXXX_X_	0x7a
#define	_XXXX_XX	0x7b
#define	_XXXXX__	0x7c
#define	_XXXXX_X	0x7d
#define	_XXXXXX_	0x7e
#define	_XXXXXXX	0x7f
#define	X_______	0x80
#define	X______X	0x81
#define	X_____X_	0x82
#define	X_____XX	0x83
#define	X____X__	0x84
#define	X____X_X	0x85
#define	X____XX_	0x86
#define	X____XXX	0x87
#define	X___X___	0x88
#define	X___X__X	0x89
#define	X___X_X_	0x8a
#define	X___X_XX	0x8b
#define	X___XX__	0x8c
#define	X___XX_X	0x8d
#define	X___XXX_	0x8e
#define	X___XXXX	0x8f
#define	X__X____	0x90
#define	X__X___X	0x91
#define	X__X__X_	0x92
#define	X__X__XX	0x93
#define	X__X_X__	0x94
#define	X__X_X_X	0x95
#define	X__X_XX_	0x96
#define	X__X_XXX	0x97
#define	X__XX___	0x98
#define	X__XX__X	0x99
#define	X__XX_X_	0x9a
#define X__XX_XX	0x9b
#define X__XXX__	0x9c
#define X__XXX_X	0x9d
#define	X__XXXX_	0x9e
#define	X__XXXXX	0x9f
#define	X_X_____	0xa0
#define	X_X____X	0xa1
#define	X_X___X_	0xa2
#define	X_X___XX	0xa3
#define	X_X__X__	0xa4
#define	X_X__X_X	0xa5
#define	X_X__XX_	0xa6
#define	X_X__XXX	0xa7
#define	X_X_X___	0xa8
#define	X_X_X__X	0xa9
#define	X_X_X_X_	0xaa
#define	X_X_X_XX	0xab
#define	X_X_XX__	0xac
#define	X_X_XX_X	0xad
#define	X_X_XXX_	0xae
#define	X_X_XXXX	0xaf
#define	X_XX____	0xb0
#define X_XX___X	0xb1
#define	X_XX__X_	0xb2
#define	X_XX__XX	0xb3
#define	X_XX_X__	0xb4
#define	X_XX_X_X	0xb5
#define	X_XX_XX_	0xb6
#define	X_XX_XXX	0xb7
#define	X_XXX___	0xb8
#define	X_XXX__X	0xb9
#define	X_XXX_X_	0xba
#define	X_XXX_XX	0xbb
#define	X_XXXX__	0xbc
#define	X_XXXX_X	0xbd
#define	X_XXXXX_	0xbe
#define	X_XXXXXX	0xbf
#define	XX______	0xc0
#define	XX_____X	0xc1
#define	XX____X_	0xc2
#define	XX____XX	0xc3
#define	XX___X__	0xc4
#define	XX___X_X	0xc5
#define	XX___XX_	0xc6
#define	XX___XXX	0xc7
#define	XX__X___	0xc8
#define	XX__X__X	0xc9
#define	XX__X_X_	0xca
#define	XX__X_XX	0xcb
#define	XX__XX__	0xcc
#define	XX__XX_X	0xcd
#define	XX__XXX_	0xce
#define XX__XXXX	0xcf
#define	XX_X____	0xd0
#define	XX_X___X	0xd1
#define	XX_X__X_	0xd2
#define	XX_X__XX	0xd3
#define	XX_X_X__	0xd4
#define	XX_X_X_X	0xd5
#define	XX_X_XX_	0xd6
#define	XX_X_XXX	0xd7
#define	XX_XX___	0xd8
#define	XX_XX__X	0xd9
#define	XX_XX_X_	0xda
#define	XX_XX_XX	0xdb
#define	XX_XXX__	0xdc
#define	XX_XXX_X	0xdd
#define	XX_XXXX_	0xde
#define	XX_XXXXX	0xdf
#define	XXX_____	0xe0
#define	XXX____X	0xe1
#define	XXX___X_	0xe2
#define	XXX___XX	0xe3
#define	XXX__X__	0xe4
#define	XXX__X_X	0xe5
#define	XXX__XX_	0xe6
#define	XXX__XXX	0xe7
#define	XXX_X___	0xe8
#define	XXX_X__X	0xe9
#define	XXX_X_X_	0xea
#define	XXX_X_XX	0xeb
#define	XXX_XX__	0xec
#define	XXX_XX_X	0xed
#define	XXX_XXX_	0xee
#define	XXX_XXXX	0xef
#define	XXXX____	0xf0
#define	XXXX___X	0xf1
#define	XXXX__X_	0xf2
#define	XXXX__XX	0xf3
#define	XXXX_X__	0xf4
#define	XXXX_X_X	0xf5
#define	XXXX_XX_	0xf6
#define	XXXX_XXX	0xf7
#define	XXXXX___	0xf8
#define	XXXXX__X	0xf9
#define	XXXXX_X_	0xfa
#define	XXXXX_XX	0xfb
#define	XXXXXX__	0xfc
#define	XXXXXX_X	0xfd
#define	XXXXXXX_	0xfe
#define	XXXXXXXX	0xff

/**************************************************************
*
*      Compatibility with older versions
*
***************************************************************
*/

#define GUI_DispString_UC  GUI_UC_DispString
#define GUI_SelLayer       GUI_SelectLayer
#if defined(__cplusplus)
}
#endif 

#endif   /* ifdef GUI_H */

/*************************** End of file ****************************/
	 	 			 		    	 				 	  			   	 	 	 	 	 	  	  	      	   		 	 	 		  		  	 		 	  	  			     			       	   	 			  		    	 	     	 				  	 					 	 			   	  	  			 				 		 	 	 			     			 
